import {get, post, put, del, exportRequest} from '@/utils/request';
import {BaseListResponse, BaseResponse} from "@/api/system/index";
import {SysUser} from "@/api/system/user.ts";

export interface SysRole extends BaseResponse{
    admin: boolean
    dataScope: string
    delFlag: string
    deptCheckStrictly: boolean
    deptIds?: number[]
    flag: boolean
    menuCheckStrictly: boolean
    menuIds: number[]
    permissions: any
    remark: string
    roleId: number
    roleKey: string
    roleName: string
    roleSort: number
    status: string
}

interface RoleListParams {

}

// 获取角色列表
export const getRoleListApi = (data: RoleListParams) => {
    return get<BaseListResponse<SysRole>>('/system/role/list', data);
};
// 新增用户
export const insetRoleApi = (data: SysUser) => {
    return post('/system/role', data);
};

// 编辑用户
export const updateRoleApi = (data: SysUser) => {
    return put('/system/role', data);
};

// 修改角色状态
export const changeRoleStatusApi = (params: any) => {
    return put('/system/role/changeStatus', params);
};

export const getRoleMenuTreeSelectApi = (id?: any) => {
    return get(`/system/menu/roleMenuTreeselect/${id ? id : ""}`);
}